<template>
  <div class="goods">
    <tab v-model="$route.meta.childIndex">
      <tab-item @click.native="mygoods">我的货架</tab-item>
      <tab-item @click.native="addgoods">添加商品</tab-item>
    </tab>
    <keep-alive>
      <router-view class="goods-router-view"/>
    </keep-alive>
  </div>
</template>
<script>
import { Tab, TabItem } from "vux";
export default {
  name: "goods",
  data() {
    return {};
  },
  components: {
    Tab,
    TabItem
  },
  methods:{
    mygoods(){
      this.$router.push({name:'mygoods'});
      this.$store.commit("changerouter", {currouter:'router_goods_name',changerouter:this.$route.path});
    },
    addgoods(){
      this.$router.push({name:'addgoods'});
      this.$store.commit("changerouter", {currouter:'router_goods_name',changerouter:this.$route.path});
    }
  },
  created() {}
};
</script>
<style scoped>
.goods-router-view{
  position: absolute;
  top:44px;
  bottom: 0;
  width: 100%;
}
</style>